package com.atsmart.app.webservice;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.apache.http.NameValuePair;
import org.apache.http.client.utils.URLEncodedUtils;
import org.apache.http.message.BasicNameValuePair;

public class ServiceHost {
	
//	 private static final String URL = "http://192.168.10.116:9099/";
//	 private static final String URL = "http://demo.atsmart.cn:6666/";
	/**正式平台URL*/
//	private static final String URL = "http://biz2.atsmart.com:8088/";
	private static final String URL = "http://appserver.atsmart.com:8088/";
    public ServiceHost() {

    }


    public static String encodeUrl(Map<String, String> parms) {
        List<NameValuePair> qparams = getParamsList(parms);
        if (qparams != null && qparams.size() > 0) {
            return URLEncodedUtils.format(qparams, "utf-8");
        }
        return null;
    }

    private static List<NameValuePair> getParamsList(
            Map<String, String> paramsMap) {
        if (paramsMap == null || paramsMap.size() == 0) {
            return null;
        }
        List<NameValuePair> params = new ArrayList<NameValuePair>();
        for (Map.Entry<String, String> map : paramsMap.entrySet()) {
            params.add(new BasicNameValuePair(map.getKey(), map.getValue()));
        }
        return params;
    }

    public static String getUpdataInfo(){
    	return URL + "updated";
    }
    
    public static String getLoginURL() {
        return URL + "register";
    }

    public static String getTaskListURL(){
    	return URL + "task";
    }
    public static String getUpdateTaskListURL(){
    	return URL + "updatedtask";
    }
    public static String getTemplateURL(){
    	return URL + "template";
    }
    public static String getUpdatedTemplateURL(){
    	return URL + "updatedtemplate";
    }
    public static String getClientsURL(){
    	return URL + "pol";
    }
    public static String getUpdatedPolURL(){
    	return URL + "updatedpol";
    }
    public static String getTemplateDetailURL(){
    	return URL + "templateitem";
    }

    public static String getMsgURL(){
    	return URL + "message";
    }
    public static String sendMsgURL(){
    	return URL + "message";
    }
    public static String getMsgDetail(){
    	return URL + "messagedetail";
    }
   
  

    public static String uploadImage(){
    	return URL + "upload";
    }

    public static String upload(){
    	return URL + "templatecontent";
    }

    public static String reportLocationURL(){
    	return URL + "position";
    }
    
    /**
     * @return 服务端版本URL
     */
    public static String versionLocationURL(){
    	return URL + "version";
    }
    public static String updateNumberURL(){
    	return URL + "updatednumber";
    }
    public static String positiontimeURL(){
    	return URL + "positiontime";
    }
    public static String httpURL(){
    	return URL ;
    }
    public static String productGroup(){
    	return URL +"productgroup";
    }
    public static String getUpdateproductgroup(){
    	return URL +"updatedproductgroup";
    }
    public static String product(){
    	return URL +"product";
    }
    public static String getUpdatedproduct(){
    	return URL +"updatedproduct";
    }
    public static String productitem(){
    	return URL +"productitem";
    }
    public static String templateitemoption(){
    	return URL +"templateitemoption";
    }
    
    public static String keepURL(){
    	return URL +"keeping";
    }
}
